home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1997 / MacHack 1997.toast / Hacks / Hacks ’96 / VideoFolder 1.0a / Source / MoreFiles 1.4.1 / FSpCompat.h < prev    next >
Text File  |  1995-12-21  |  10KB  |  275 lines

  1. /*
  2. **    Apple Macintosh Developer Technical Support
  3. **
  4. **    FSSpec compatibility functions.
  5. **
  6. **    by Jim Luther, Apple Developer Technical Support Emeritus
  7. **
  8. **    File:        FSpCompat.h
  9. **
  10. **    Copyright © 1992-1995 Apple Computer, Inc.
  11. **    All rights reserved.
  12. **
  13. **    You may incorporate this sample code into your applications without
  14. **    restriction, though the sample code has been provided "AS IS" and the
  15. **    responsibility for its operation is 100% yours.  However, what you are
  16. **    not permitted to do is to redistribute the source as "DSC Sample Code"
  17. **    after having made changes. If you're going to re-distribute the source,
  18. **    we require that you make it clear in the source that the code was
  19. **    descended from Apple Sample Code, but that you've made changes.
  20. */
  21.  
  22. #ifndef __FSPCOMPAT__
  23. #define __FSPCOMPAT__
  24.  
  25. #include <Types.h>
  26. #include <Files.h>
  27.  
  28. /*****************************************************************************/
  29.  
  30. pascal    OSErr    FSMakeFSSpecCompat(short vRefNum,
  31.                                    long dirID,
  32.                                    ConstStr255Param fileName,
  33.                                    FSSpecPtr spec);
  34. /*    ¶ Initialize a FSSpec record.
  35.     The FSMakeFSSpecCompat function fills in the fields of an FSSpec record.
  36.     If the file system can't create the FSSpec, then the compatibility code
  37.     creates a FSSpec that is exactly like an FSSpec except that spec.name
  38.     for a file may not have the same capitalization as the file's catalog
  39.     entry on the disk volume. That is because fileName is parsed to get the
  40.     name instead of getting the name back from the file system. This works
  41.     fine with System 6 where FSMakeSpec isn't available.
  42.     
  43.     vRefNum        input:    Volume specification.
  44.     dirID        input:    Directory ID.
  45.     fileName    input:    Pointer to object name, or nil when dirID specifies
  46.                         a directory that's the object.
  47.     spec        output:    A file system specification to be filled in by
  48.                         FSMakeFSSpecCompat.
  49. */
  50.  
  51. /*****************************************************************************/
  52.  
  53. pascal    OSErr    FSpOpenDFCompat(const FSSpec *spec,
  54.                                 char permission,
  55.                                 short *refNum);
  56. /*    ¶ Open a file's data fork.
  57.     The FSpOpenDFCompat function opens the data fork of the file specified
  58.     by spec.
  59.     Differences from FSpOpenDF: If FSpOpenDF isn't available,
  60.     FSpOpenDFCompat uses PHBOpen because System 6 doesn't support PBHOpenDF.
  61.     This means FSpOpenDFCompat could accidentally open a driver if the
  62.     spec->name begins with a period.
  63.     
  64.     spec        input:    An FSSpec record specifying the file whose data
  65.                         fork is to be opened.
  66.     permission    input:    A constant indicating the desired file access
  67.                         permissions.
  68.     refNum        output:    A reference number of an access path to the file's
  69.                         data fork.
  70.  
  71.     __________
  72.     
  73.     See also:    FSpOpenAware
  74. */
  75.  
  76. /*****************************************************************************/
  77.  
  78. pascal    OSErr    FSpOpenRFCompat(const FSSpec *spec,
  79.                                 char permission,
  80.                                 short *refNum);
  81. /*    ¶ Open a file's resource fork.
  82.     The FSpOpenRFCompat function opens the resource fork of the file
  83.     specified by spec.
  84.     
  85.     spec        input:    An FSSpec record specifying the file whose resource
  86.                         fork is to be opened.
  87.     permission    input:    A constant indicating the desired file access
  88.                         permissions.
  89.     refNum        output:    A reference number of an access path to the file's
  90.                         resource fork.
  91.  
  92.     __________
  93.     
  94.     See also:    FSpOpenRFAware
  95. */
  96.  
  97.  
  98. /*****************************************************************************/
  99.  
  100. pascal    OSErr    FSpCreateCompat(const FSSpec *spec,
  101.                                 OSType creator,
  102.                                 OSType fileType,
  103.                                 ScriptCode scriptTag);
  104. /*    ¶ Create a new file.
  105.     The FSpCreateCompat function creates a new file with the specified
  106.     type, creator, and script code.
  107.     Differences from FSpCreate: FSpCreateCompat correctly sets the
  108.     fdScript in the file's FXInfo record to scriptTag if the problem
  109.     isn't fixed in the File Manager code.
  110.     
  111.     spec        input:    An FSSpec record specifying the file to create.
  112.     creator        input:    The creator of the new file.
  113.     fileType    input    The file type of the new file.
  114.     scriptCode    input:    The code of the script system in which the file
  115.                         name is to be displayed.
  116. */
  117.  
  118. /*****************************************************************************/
  119.  
  120. pascal    OSErr    FSpDirCreateCompat(const FSSpec *spec,
  121.                                    ScriptCode scriptTag,
  122.                                    long *createdDirID);
  123. /*    ¶ Create a new directory.
  124.     The FSpDirCreateCompat function creates a new directory and returns the
  125.     directory ID of the newDirectory.
  126.     
  127.     spec            input:    An FSSpec record specifying the directory to
  128.                             create.
  129.     scriptCode        input:    The code of the script system in which the
  130.                             directory name is to be displayed.
  131.     createdDirID    output:    The directory ID of the directory that was
  132.                             created.
  133. */
  134.  
  135. /*****************************************************************************/
  136.  
  137. pascal    OSErr    FSpDeleteCompat(const FSSpec *spec);
  138. /*    ¶ Delete a file or directory.
  139.     The FSpDeleteCompat function deletes a file or directory.
  140.     
  141.     spec            input:    An FSSpec record specifying the file or 
  142.                             directory to delete.
  143. */
  144.  
  145. /*****************************************************************************/
  146.  
  147. pascal    OSErr    FSpGetFInfoCompat(const FSSpec *spec,
  148.                                   FInfo *fndrInfo);
  149. /*    ¶ Get the finder information for a file.
  150.     The FSpGetFInfoCompat function gets the finder information for a file.
  151.  
  152.     spec        input:    An FSSpec record specifying the file.
  153.     fndrInfo    output:    If the object is a file, then its FInfo.
  154.  
  155.     __________
  156.     
  157.     Also see:    FSpGetDInfo
  158. */
  159.  
  160. /*****************************************************************************/
  161.  
  162. pascal    OSErr    FSpSetFInfoCompat(const FSSpec *spec,
  163.                                   const FInfo *fndrInfo);
  164. /*    ¶ Set the finder information for a file.
  165.     The FSpSetFInfoCompat function sets the finder information for a file.
  166.  
  167.     spec        input:    An FSSpec record specifying the file.
  168.     fndrInfo    input:    The FInfo.
  169.  
  170.     __________
  171.     
  172.     Also see:    FSpSetDInfo
  173. */
  174.  
  175. /*****************************************************************************/
  176.  
  177. pascal    OSErr    FSpSetFLockCompat(const FSSpec *spec);
  178. /*    ¶ Lock a file.
  179.     The FSpSetFLockCompat function locks a file.
  180.  
  181.     spec        input:    An FSSpec record specifying the file.
  182. */
  183.  
  184. /*****************************************************************************/
  185.  
  186. pascal    OSErr    FSpRstFLockCompat(const FSSpec *spec);
  187. /*    ¶ Unlock a file.
  188.     The FSpRstFLockCompat function unlocks a file.
  189.  
  190.     spec        input:    An FSSpec record specifying the file.
  191. */
  192.  
  193. /*****************************************************************************/
  194.  
  195. pascal    OSErr    FSpRenameCompat(const FSSpec *spec,
  196.                                 ConstStr255Param newName);
  197. /*    ¶ Rename a file or directory.
  198.     The FSpRenameCompat function renames a file or directory.
  199.  
  200.     spec        input:    An FSSpec record specifying the file.
  201.     newName        input:    The new name of the file or directory.
  202. */
  203.  
  204. /*****************************************************************************/
  205.  
  206. pascal    OSErr    FSpCatMoveCompat(const FSSpec *source,
  207.                                  const FSSpec *dest);
  208. /*    ¶ Move a file or directory to a different location on on the same volume.
  209.     The FSpCatMoveCompat function moves a file or directory to a different
  210.     location on on the same volume.
  211.  
  212.     source        input:    An FSSpec record specifying the file or directory.
  213.     dest        input:    An FSSpec record specifying the name and location
  214.                         of the directory into which the source file or
  215.                         directory is to be moved.
  216. */
  217.  
  218. /*****************************************************************************/
  219.  
  220. pascal    OSErr    FSpExchangeFilesCompat(const FSSpec *source,
  221.                                        const FSSpec *dest);
  222. /*    ¶ Exchange the data stored in two files on the same volume.
  223.     The FSpExchangeFilesCompat function swaps the data in two files by
  224.     changing the information in the volume's catalog and, if the files
  225.     are open, in the file control blocks.
  226.     Differences from FSpExchangeFiles: Correctly exchanges files on volumes
  227.     that don't support PBExchangeFiles. FSpExchangeFiles attempts to support
  228.     volumes that don't support PBExchangeFiles, but in System 7, 7.0.1, 7.1,
  229.     and 7 Pro, the compatibility code just doesn't work on volumes that
  230.     don't support PBExchangeFiles (even though you may get a noErr result).
  231.     System Update 3.0 and System 7.5 and later have the problems in
  232.     FSpExchangeFiles corrected.
  233. */
  234.  
  235. /*****************************************************************************/
  236.  
  237. pascal    short    FSpOpenResFileCompat(const FSSpec *spec,
  238.                                      SignedByte permission);
  239. /*    ¶ Open a file's resource file.
  240.     The FSpOpenResFileCompat function opens the resource file specified
  241.     by spec.
  242.     
  243.     spec            input:    An FSSpec record specifying the file whose
  244.                             resource file is to be opened.
  245.     permission        input:    A constant indicating the desired file access
  246.                             permissions.
  247.     function result    output:    A resource file reference number, or if there's
  248.                             an error -1.
  249. */
  250.  
  251. /*****************************************************************************/
  252.  
  253. pascal    void    FSpCreateResFileCompat(const FSSpec *spec,
  254.                                        OSType creator,
  255.                                        OSType fileType,
  256.                                        ScriptCode scriptTag);
  257. /*    ¶ Create a resource file.
  258.     The FSpCreateResFileCompat function creates a new resource file with
  259.     the specified type, creator, and script code.
  260.     Differences from FSpCreateResFile: FSpCreateResFileCompat correctly
  261.     sets the fdScript in the file's FXInfo record to scriptTag if the
  262.     problem isn't fixed in the File Manager code.
  263.     
  264.     spec        input:    An FSSpec record specifying the resource file to create.
  265.     creator        input:    The creator of the new file.
  266.     fileType    input    The file type of the new file.
  267.     scriptCode    input:    The code of the script system in which the file
  268.                         name is to be displayed.
  269. */
  270.  
  271. /*****************************************************************************/
  272.  
  273. #endif    /* __FSPCOMPAT__ */
  274.  
  275.